﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class RenderModeControl : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        //for (int i = 0; i < gameObject.transform.childCount; i++)
        //{
        //    Transform wallTransform = gameObject.transform.GetChild(i);
        //    Renderer renderer = wallTransform.gameObject.GetComponent<MeshRenderer>();
        //    if(renderer == null)
        //    {
        //        continue;
        //    }
        //    Color mcolor = renderer.material.color;
        //    mcolor.a = 0.4f;
        //    YPTools.SetMaterialRenderingMode(renderer.material, RenderingMode.Transparent);
        //    renderer.material.color = mcolor;
        //}

       Renderer[] renderers = GetComponentsInChildren<Renderer>();
        
        for(int i =0; i<renderers.Length; i++)
        {
          Renderer renderer =  renderers[i];
            if (renderer == null)
            {
                continue;
            }
            Color mcolor = renderer.material.color;
            mcolor.a = 0.4f;
            YPTools.SetMaterialRenderingMode(renderer.material, RenderingMode.Transparent);
            renderer.material.color = mcolor;
        }
    }

    // Update is called once per frame
    void Update()
    {

    }
}
